<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>网站信息</title>
    <link rel="stylesheet" href="__ADMIN__/css/pintuer.css">
    <link rel="stylesheet" href="__ADMIN__/css/admin.css">
    <script src="__ADMIN__/js/jquery.js"></script>
    <script src="__ADMIN__/js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder">导航信息列表</strong></div>
    <div class="padding border-bottom">
        <a class="button border-main" href="{:url('admin/nav/add')}"><span class="icon-plus-square-o"></span> 添加导航</a>
    </div>
    <table class="table table-hover text-center">
        <tr>
            <th width="5%">ID</th>
            <th>导航名称</th>
            <th>导航链接</th>
            <th>导航排序</th>
            <th>导航状态</th>
            <th>添加时间</th>
            <th width="250">操作</th>
        </tr>
        {volist name="list" id="v"}
        <tr>
            <td>{$v.id}</td>
            <td>{$v.name}</td>
            <td>{$v.link}</td>
            <td>{$v.order}</td>
            {switch name="v.status"}
            {case value="应用"}<td>{$v.status}</td>{/case}
            {case value="禁用"}<td style="color:red;">{$v.status}</td>{/case}
            {/switch}
            <td>{$v.create_time}</td>
            <td>
                <div class="button-group">
                    <a type="button" class="button border-main" href="{:url('admin/nav/edi',['id'=>$v.id])}"><span class="icon-edit"></span>修改</a>
                    <a class="button border-red"  onclick="return del({$v.id})"><span class="icon-trash-o"></span> 删除</a>
                </div>
            </td>
        </tr>
        {/volist}
        <tr>
            <td colspan="8">
                {$page}
            </td>
        </tr>
    </table>

</div>
<script>
    function del(id){
        if(confirm("您确定要删除吗?")){
            $.ajax({
                type : "GET",
                url : "{:url('admin/nav/del')}",
                data : "id="+id,
                dataType :'json',
                success:function (data) {
//                    console.log(data);
                    alert(data);
                    location.reload(true);
                },
                error:function (data) {
                },
            })
        }else{
            return false;
        }
    }
</script>
</body></html>